package com.gsta.cdn.cdr.entity;

public class ResultEntity {

    private int code;
    private String msg;
    private int count;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static ResultEntity ok() {
        return ok(null);
    }

    public static ResultEntity ok(Object data) {
        ResultEntity resultEntity = new ResultEntity();
        resultEntity.setCode(0);
        resultEntity.setMsg("成功");
        resultEntity.setData(data);
        return resultEntity;
    }

    public static ResultEntity error(String msg) {
        ResultEntity resultEntity = new ResultEntity();
        resultEntity.setCode(1);
        resultEntity.setMsg(msg);
        return resultEntity;
    }

}
